import useScreenSize from '@/hooks/useScreenSize';
import React, { useEffect, useState } from 'react';
import KLine from './KLine';

const initWidth = 654;
export default function KlineWrap() {
  const [width, setWidth] = useState<number>(initWidth);
  const screenWidth = useScreenSize().width;
  useEffect(() => {
    console.log('====screenWidth');
    let _width = initWidth;
    if (screenWidth > 1200) _width = screenWidth - 266;
    console.log('_width: ', _width);
    setTimeout(() => {
      setWidth(_width);
    }, 1000);
  }, [screenWidth]);

  return (
    <div>
      KlineWrap width：{width}
      <KLine />
    </div>
  );
}
